package com.liukai.todo.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import java.util.Date;

import com.baomidou.mybatisplus.annotation.TableName;
import com.liukai.todo.utils.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;

/**
 * <p>
 * 待办事项表
 * </p>
 *
 * @author liukai
 * @since 2021-07-30
 */
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@AllArgsConstructor
@ToString
@Accessors(chain = true)
@TableName("tb_todo")
@ApiModel(value="TodoInfo对象", description="存放TodoInfo")
public class TodoInfo implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 用户id
     */
    @TableField("userId")
    @ApiModelProperty(value = "用户Id")
    private Integer userId;

    /**
     * 待办id
     */
    @TableId(value = "todoId", type = IdType.AUTO)
    @ApiModelProperty(value = "待办id")
    private Integer todoId;

    /**
     * 待办名称
     */
    @TableField("todoName")
    @ApiModelProperty(value = "待办名称")
    private String todoName;

    /**
     * 待办描述
     */
    @TableField("todoDetial")
    @ApiModelProperty(value = "待办描述")
    private String todoDetial;

    /**
     * 待办类型
     */
    @TableField("typeId")
    @ApiModelProperty(value = "待办类型")
    private Integer typeId;

    /**
     * 创建时间
     */
    @TableField("createTime")
    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;

    /**
     * 结束时间
     */
    @TableField("stopTime")
    @ApiModelProperty(value = "结束时间")
    private LocalDateTime stopTime;

    /**
     * 花费时间
     */
    @TableField("totalTime")
    @ApiModelProperty(value = "花费时间")
    private Integer totalTime;

    /**
     * 开始时间
     */
    @TableField("startTime")
    @ApiModelProperty(value = "开始时间")
    private LocalDateTime startTime;

    /**
     * 计划时间
     */
    @TableField("planTime")
    @ApiModelProperty(value = "计划时间")
    private Integer planTime;

    /**
     * 是否完成
     */
    @TableField("status")
    @ApiModelProperty(value = "是否完成")
    private Integer status;

    /**
     * 待办完成总结
     */
    @TableField("todoConclusion")
    @ApiModelProperty(value = "待办完成总结")
    private String todoConclusion;

    public TodoInfo(Integer userId, String todoName, String todoDetial,
                    Integer typeId, LocalDateTime createTime, LocalDateTime stopTime,
                    Integer totalTime, LocalDateTime startTime, Integer planTime,
                    Integer status, String todoConclusion) {
        this.userId = userId;
        this.todoName = todoName;
        this.todoDetial = todoDetial;
        this.typeId = typeId;
        this.createTime = createTime;
        this.stopTime = stopTime;
        this.totalTime = totalTime;
        this.startTime = startTime;
        this.planTime = planTime;
        this.status = status;
        this.todoConclusion = todoConclusion;
    }

    public void setCreateTime(Date date) {
        this.createTime = DateUtil.DateToLocalDateTime(date);
    }

    public void setStartTime(Date date) {
        this.startTime = DateUtil.DateToLocalDateTime(date);
    }

    public void setStopTime(Date date) {
        this.stopTime = DateUtil.DateToLocalDateTime(date);
    }
}
